package com.sneaker.shower.entity.enums;

import java.util.Arrays;

/**
 * @author Hechangjian
 * @version 1.0
 * @className SubOrderStatusEnum
 * @date 2019/07/29 18:29
 * @description 订单状态枚举
 * @program bath
 */
public enum SubOrderStatusEnum {
    WAIT_FOR_SUBMITTING("待下单", Byte.valueOf("0")),
    WAIT_FOR_TRACK("待邮寄", Byte.valueOf("1")),
    WAIT_FOR_CHECKING("待审核", Byte.valueOf("2")),
    PASSED_CHECK("审核通过", Byte.valueOf("3")),
    CHECK_FAILED("审核失败", Byte.valueOf("4")),
    WAIT_FOR_PAYING("待支付", Byte.valueOf("5")),
    PAYING("支付中", Byte.valueOf("6")),
    PAY_SUCCESS("支付成功", Byte.valueOf("7")),
    PAY_FAILED("支付失败", Byte.valueOf("8")),
    IN_HANDEL("处理中", Byte.valueOf("9")),
    HANDEL_SUCCESS("处理成功", Byte.valueOf("10")),
    ALREADY_SEND_BACK("已寄回", Byte.valueOf("11")),
    FINISHED("订单完成", Byte.valueOf("12")),
    ;

    private String message;
    private Byte code;

    SubOrderStatusEnum(String message, Byte code) {
        this.message = message;
        this.code = code;
    }

    public static SubOrderStatusEnum getByCode(Byte code) {
        return Arrays.stream(values()).filter((e) -> e.getCode().equals(code)).findFirst().orElse(null);
    }

    public String getMessage() {
        return message;
    }

    public Byte getCode() {
        return code;
    }
}
